package net.janeluo.framework.base;

import net.janeluo.framework.bean.ReturnMessage;


public class BaseModule {

    private ReturnMessage ajaxForward(int statusCode, String message, String navTabId, String rel,
            String callbackType, String forwardUrl) {
        ReturnMessage rm = new ReturnMessage();
        rm.setStatusCode(statusCode + "");
        rm.setMessage(message);
        rm.setNavTabId(navTabId);
        rm.setRel(rel);
        rm.setCallbackType(callbackType);
        rm.setForwardUrl(forwardUrl);
        return rm;
    }

    /**
     * 成功
     * 
     * @param message
     * @param navTabId
     * @param rel
     * @param callbackType
     * @param forwardUrl
     * @return
     * @throws Exception
     */
    protected ReturnMessage ajaxForwardSuccess(String message, String navTabId, String rel, String callbackType,
            String forwardUrl) {
        return ajaxForward(200, message, navTabId, rel, callbackType, forwardUrl);
    }

    /**
     * 异常
     * 
     * @param message
     * @param navTabId
     * @param rel
     * @param callbackType
     * @param forwardUrl
     * @return
     * @throws Exception
     */
    protected ReturnMessage ajaxForwardError(String message, String navTabId, String rel,
            String callbackType, String forwardUrl) {
        return ajaxForward(300, message, navTabId, rel, callbackType, forwardUrl);
    }
}
